package org.moonlight.jvm.classfile.constant.info.number;

import lombok.Getter;
import org.moonlight.jvm.classfile.ClassReader;
import org.moonlight.jvm.classfile.constant.ConstantInfo;

/**
 * CONSTANT_Long_info使用8字节存储整数常量，结构如下：
 *   CONSTANT_Long_info {
 *       u1  tag
 *       u4  high_bytes
 *       u4  low_bytes
 *   }
 *
 *   {@link ConstantInfo#CONSTANT_LONG}
 *
 * @author Moonlight
 * @createTime 2023/8/15 11:37
 **/
@Getter
public class ConstantLongInfo implements ConstantInfo {

    private long val;

    @Override
    public void readInfo(ClassReader reader) {
        this.val = reader.readUint64ToLong();
    }

    @Override
    public int tag() {
        return ConstantInfo.CONSTANT_LONG;
    }

}
